home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8546 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: gail.ripco.com!mambuhl
  2. From: mambuhl@ripco.com (Martin Ambuhl)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: dbl precision?
  5. Date: 4 Mar 1996 23:51:36 GMT
  6. Organization: Ripco Communications, Inc.
  7. Message-ID: <4hfvm8$o8p@gail.ripco.com>
  8. NNTP-Posting-Host: foley.ripco.com
  9.  
  10. fsajb4@aurora.alaska.edu (BURMAN ADLAI J) in
  11. <4h3epi$utu@news.alaska.edu> asks:
  12.  
  13. >Could some kind soul explain to a C novice how to extend the precision of
  14. >floating point numbers? You help would be greatly appreciated.
  15.  
  16. There are three floating types (each is a subset of the one below it):
  17.  
  18. type            example of      restrictions
  19.                 constant:       (check your float.h)
  20.                                 digits      epsilon
  21. float           1.0F            >= 6        1E-5
  22. double          1.0             >= 10       1E-9
  23. long double     1.0L            >= 10       1E-9
  24.  
  25. Most implementations provide more digits of precision than the
  26. above, and provide more for long double than for double.
  27.  
  28. Most implements provide increasing ranges for the powers of 10 which
  29. can be represented, but all must include 1E-37 and 1E37).
  30.  
  31. epsilon is the smallest value for which 1. and 1.+epsilon are different
  32. numbers.
  33.  
  34. If long double is insufficient for your needs, you need to look into some
  35. of the extended precision libraries.
  36.  
  37.                                                                                                                       
  38. --
  39. * Martin Ambuhl       net: mambuhl@ripco.com
  40. * Chicago, IL (USA)    
  41.